<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增免疫记录')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-ncMianyiLogs-add">
        <div class="form-group" hidden="hidden">
            <label class="col-sm-3 control-label">免疫类型  ：</label>
            <div class="col-sm-8">
                <input id="myType" name="myType" class="form-control" value="1" type="text">
            </div>
        </div>
        <div class="form-group" hidden="hidden">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <input id="myStatus" name="myStatus" class="form-control" value="1" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">圈舍号：</label>
            <div class="col-sm-8">
                <select name="roomNum" class="form-control m-b" th:with="type=${@dict.getType('cow_juanshe_num')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">存栏数量：</label>
            <div class="col-sm-8">
                <input id="stockAmount" name="stockAmount" class="form-control" type="number">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">免疫数量：</label>
            <div class="col-sm-8">
                <input id="myAmount" name="myAmount" class="form-control" type="number">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">疫苗名称：</label>
            <div class="col-sm-8">
                <select id="ymId" name="ymId" class="form-control select2-multiple" >
                    <option th:each="yimiao:${yimiaoList}" th:value="${yimiao.drugId}" th:text="${yimiao.drugName}"></option>
                </select>
            </div>
        </div>
       <!-- <div class="form-group">
            <label class="col-sm-3 control-label">疫苗生产厂家：</label>
            <div class="col-sm-8">
                <input id="ymFactory" name="ymFactory" class="form-control" type="text">
            </div>
        </div>-->
       <!-- <div class="form-group">
            <label class="col-sm-3 control-label">批号（有效期）：</label>
            <div class="col-sm-8">
                <input id="ymCode"  data-format="yyyy-MM-dd" required th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}" name="ymCode"   class="form-control" type="text" th:class="time-input" >
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">用药方法：</label>
            <div class="col-sm-8">
                <select name="myWays" class="form-control m-b" th:with="type=${@dict.getType('animalExecuteType')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">免疫剂量：</label>
            <div class="col-sm-8">
                <input id="myDose" name="myDose" class="form-control" type="number" min="0">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">免疫操作员：</label>
            <div class="col-sm-8">
                <select id="createBy" name="createBy" class="form-control select2-multiple" >
                    <option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">检测时间：</label>
            <div class="col-sm-8">
                <input id="createTime" data-type="datetime"  data-format="yyyy-MM-dd HH:mm:ss" name="createTime"  class="form-control"
                       th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}"  type="text" th:class="time-input">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea rows="4" name="remark"  class="form-control" type="text"></textarea>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
    var prefix = ctx + "system/ncMianyiLogs/cow"
    $("#form-ncMianyiLogs-add").validate({
        rules: {
            myAmount: {
                required: true,
                digits: true
            },
            stockAmount: {
                required: true,
                digits: true
            },
            myDose: {
                required: true,
                digits: true
            }
        },
        messages: {
            stockAmount: "存栏数必须为正整数",
            myAmount: "免疫数必须为正整数",
            myDose: "剂量数必须为正整数"
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-ncMianyiLogs-add').serialize());
            
        }
    }
</script>
</body>
</html>
